package 力扣日常刷题.木23一月.第01天301;

import 力扣日常刷题.ListNode;

/**
 * @author 帅小伙
 * @date 2022/3/1
 * @description
 */
public class Demo07反转链表 {

    public ListNode reverseList(ListNode head) {
        if (head == null || head.next == null) return head;
        ListNode nHead = reverseList(head.next);
        head.next.next = head;
        head.next = null;
        return nHead;
    }

}
